<%@page import="edu.uit.se.laps.web.model.TaiKhoan"%>
<%@page import="edu.uit.se.laps.web.model.LoaiSanPham"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!-- pageEncoding="UTF-8"%> -->
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ page
	import="edu.uit.se.laps.web.*,edu.uit.se.laps.web.controller.*, java.net.*,java.text.*,java.util.*"%>
	<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body,input {
	font-family: Calibri, Arial;
}

table#contact {
	border-collapse: collapse;
	width: 550px;
}

th {
	height: 40px;
	background-color: #ffee55;
}
.addsp{
	padding-top: 50px;
	padding-bottom: 100px;
}
.khungaddSP{
	
	width: 100%;
	background: #FFFFEB;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	-ms-border-radius: 10px;
	-o-border-radius: 10px;
	border-radius: 10px;
	box-shadow: 0px 0px 25px #808076;
}
h1{
	color: red;
	padding-top: 20px;
	margin-left: 20px;
}
ul{
	list-style-type: none;
}
ul a{
	width: 160px;
	display: inline-block;
}
textarea{
	max-width: 500px;
}

.taotk{
	background: red;
	height: 40px;
	color: white;
	font-size: 18px;
	cursor: pointer;
	border: none;	
	margin: 20px 20px;
}

.taotk:hover{
	background: #8F2400;
}


</style>
<title>myLife - Thêm Sản Phẩm</title>

<s:head />
<!-- the s:head de thong bao loi validation -->
</head>
<body>
	
	<%
		ShoppingCart cart = (ShoppingCart) session
				.getAttribute("ShoppingCart");
		if (cart == null) {
			cart = new ShoppingCart();
			session.setAttribute("ShoppingCart", cart);
		}
		List loaiSPList = cart.getLoaiSP();
		
		TaiKhoanSession tkSession = (TaiKhoanSession) session.getAttribute("TaiKhoanSession");
		if (tkSession == null) {
			tkSession = new TaiKhoanSession();
			session.setAttribute("TaiKhoanSession", tkSession);
		}
		TaiKhoan tk = tkSession.getTk();
		
	%>
	
	
	
	<tiles:insertTemplate template="TemAdmin.jsp">
	<tiles:putAttribute name="adminFocus">
	
	<div class="addsp" align="left">
	<div class="khungaddSP">
	
	<h1>Thêm sản phẩm</h1>
	<s:form action="addSP" method="post">
		<ul>
		<li><a>Tên sản phẩm<label style="color:red">*</label></a><input type="text" name="tenSP" size="30" required="on"/></li>
		
		<li><a>Loại sản phẩm<label style="color:red">*</label></a><select name="idLoaiSP" required="on">
		<%
		for (int i = 0; i < loaiSPList.size(); i++){
			LoaiSanPham loaiSP = (LoaiSanPham) loaiSPList.get(i);
		%>
		<option><%= loaiSP.getTenLoaiSP() %></option>
		<%
			}
		%>
		</select></li>
		
		<li><a>Mô tả<label style="color:red">*</label></a><textarea name="moTa" required="on"></textarea></li>
		<li><a>Đặc điểm<label style="color:red">*</label></a><textarea name="dacDiem" required="on"></textarea></li>
		<li><a>Điều kiện<label style="color:red">*</label></a><textarea name="dieuKien" required="on"></textarea></li>
		<li><a>Hình ảnh<label style="color:red">*</label></a><textarea name="srcImg" required="on"></textarea></li>
		<li><a>Hình ảnh chi tiết:</a><textarea name="srcImgCT" ></textarea></li>
		<li><a>Giá<label style="color:red">*</label></a><input type="number" name="gia" size="7" required="on" min="0"/></li>
		<li><a>Số Lượng<label style="color:red">*</label></a><input type="number" name="soLuongTon" size="3" required="on" min="0"/></li>
		<li><a>Ghi chú:</a><textarea name="ghiChu" ></textarea></li>
				
		</ul>
		
		<input class="taotk" type="submit" value="Thêm sản phẩm" />

	</s:form>

	</div>
	</div>
	</tiles:putAttribute>
	</tiles:insertTemplate>
		
</body>
</html>